<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>职员管理</title>
    <link rel="stylesheet" href="__ROOT__/static/plugins/bootstrap/css/bootstrap.css">
</head>
<style>
    table tr td {
        text-align: center;
    }
</style>
<body>
<table class="table table-hover table-striped table-bordered wst-form">
    <thead>
    <tr>
        <td>序号</td>
        <td>账号</td>
        <td>姓名</td>
        <td>编号</td>
        <td>工作状态</td>
        <td>最后登录时间</td>
        <td>最后登录ip</td>
        <td>状态</td>
        <td>操作</td>
    </tr>
    </thead>
    <tbody>
    {volist name="res" id="vo"}
    <tr>
        <td>{$vo.staff_id}</td>
        <td>{$vo.login_name}</td>
        <td>{$vo.staff_name}</td>
        <td>{$vo.staff_no}</td>
        <td>{if condition="$vo.work_status eq 1"}在职 {else /}离职{/if}</td>
        <td>{$vo.last_time|date="Y-m-d H:i:s",###}</td>
        <td>{$vo.last_ip}</td>
        <td>
            <div class="dropdown">
                {if condition="$vo.staff_status eq 0"}
                <button class="btn btn-danger dropdown-toggle wst-btn-dropdown" type="button" data-toggle="dropdown">
                    停用
                    <span class="caret"></span>
                </button>
                {else /}
                <button class="btn btn-success dropdown-toggle wst-btn-dropdown" type="button" data-toggle="dropdown">
                    启用
                    <span class="caret"></span>
                </button>
                {/if}
                <ul class="dropdown-menu" role="menu">
                    <li role="presentation"><a role="menuitem" tabindex="-1"
                                               href="javascript:toggleStatus(1,{$vo.staff_id})">显示</a></li>
                    <li role="presentation"><a role="menuitem" tabindex="-1"
                                               href="javascript:toggleStatus(0,{$vo.staff_id})">隐藏</a></li>
                </ul>

            </div>
        </td>
        <td>
            <a class="btn btn-default glyphicon glyphicon-pencil"
               href="{:url('admin/Staff/edit',array('id'=>$vo['staff_id']))}">修改</a>&nbsp;
            <button type="button" class="btn btn-default glyphicon glyphicon-trash"
                    onclick="javascript:del({$vo.staff_id})">刪除
            </button>
        </td>
    </tr>
    {/volist}
    </tbody>
</table>
</body>
</html>
<script src="__ROOT__/static/plugins/jquery-3.2.1/jquery-3.2.1.js"></script>
<script src="__ROOT__/static/plugins/bootstrap/js/bootstrap.min.js"></script>
<script src="__ROOT__/static/plugins/layer/layer.min.js" charset="utf-8"></script>
<script src="__ROOT__/static/admin/role/js/x-layui.js" charset="utf-8"></script>
<script>
    function toggleStatus(s, id) {
        var params = {};
        params.s = s;
        params.id = id;
        $.post("{:url('admin/Users/setStatus')}", params, function (data) {
            if (data ==1) {
                layer.msg('操作成功', {icon: 1,time:1000,offset:['120px']});
                setTimeout('location.replace(location.href)',1500);
            } else {

            }

        });
    }

</script>